package com.jkd.mapper;

import com.github.pagehelper.PageHelper;
import com.jkd.model.pojo.Room;
import com.jkd.model.vo.RoomQueryVo;
import com.jkd.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class testRoomMapper {
    @Test
    public void testSelectAll(){
        SqlSession sqlSession = MyBatisUtil.getSqlSession();
       RoomMapper roomMapper = sqlSession.getMapper(RoomMapper.class);
//        PageHelper.startPage(1,4);
       List<Room> list  = roomMapper.selectAll();
       list.forEach(e -> System.out.println(e));
       MyBatisUtil.closeSqlSession(sqlSession);
    }

    @Test
    public void testSelectByConditions(){
        SqlSession sqlSession = MyBatisUtil.getSqlSession();
       RoomMapper roomMapper =  sqlSession.getMapper(RoomMapper.class);
        RoomQueryVo roomQueryVo = new RoomQueryVo();
        roomQueryVo.setBuildingId(1);
        roomQueryVo.setCapacity(4);
        roomQueryVo.setStatusId(1);
        roomQueryVo.setRoomNum("4");
       List<Room> rooms = roomMapper.selectByCondition(roomQueryVo);
       rooms.forEach(e-> System.out.println(e));
    }
}
